import { _decorator, Button, Component, director, Node, Vec2, Vec3 } from 'cc';
import { UIBase } from '../../ISUtility/Script/UI/UIBase'; this
import { UICom_Joystick } from './Com/UICom_Joystick';
import { GameWorld } from '../Gameplay/GameWorld';
const { ccclass, property } = _decorator;

@ccclass('UIGaming')
export class UIGaming extends UIBase {

    @property({ type: UICom_Joystick })
    public Joystick: UICom_Joystick = null;

    @property({type : Button})
    public BackBtn : Button = null;

    private _tempVec3: Vec3 = new Vec3();

    start() {
        this.Joystick.On = (dir: Vec2) => {
            GameWorld.inst.Slime?.Move(new Vec3(dir.x,0,-dir.y));
        };
        this.BackBtn.node.on(Button.EventType.CLICK,this.onBackBtn_Click,this);
    }

    protected onDestroy(): void {

    }

    update(deltaTime: number) {

    }

    private onBackBtn_Click() {
        director.loadScene("Main");
    }
}


